package com.hh.service.dao;

import com.hh.common.model.user.UserAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hh.common.response.UserAddressResponse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户地址表 Mapper 接口
 * +----------------------------------------------------------------------
 * | hh [ hh赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2022 https://www.hh.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed hh并不是自由软件，未经许可不能去掉hh相关版权
 * +----------------------------------------------------------------------
 * | Author: hh Team <admin@hh.com>
 * +----------------------------------------------------------------------
 */
public interface UserAddressDao extends BaseMapper<UserAddress> {

    @Select("select id,real_name,phone,province,city,city_id,district,district_id,detail,is_default from eb_user_address where uid = #{userId} and is_del=0 order by is_default desc,id desc")
    List<UserAddressResponse> getUserAddressList(@Param("userId") Integer userId);
}
